<?php
	$con = mysql_connect("localhost:3306","root","shibani");
	if (!$con)
	{
		die('Could not connect: ' . mysql_error());
	}

	mysql_select_db("cal2sync", $con);

	$result = mysql_query("SELECT u_id FROM user WHERE username = '".$_POST['username']."'");
	while($row = mysql_fetch_array($result))
	{
		$uid = $row['u_id'];
	}
	mysql_query("UPDATE rules SET action = '".$_POST['action']."' WHERE u_id = '".$uid."' AND event_type = '".$_POST['event_type']."'");

	mysql_close($con);
?>